package com.jt.blog.service;/**
 * Created by Administrator on 2016/8/31.
 */

import com.jt.blog.model.Category;
import com.jt.blog.model.User;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author TIM
 * @create 2016-08-31 17
 **/
@Service
public class CategoryServiceImpl extends AbstractBaseService<Category> implements CategoryService {

    public List<Category> list() {
        Example example = new Example(User.class);
        example.setOrderByClause("sort_index");
        List<Category> categories = mapper.selectByExample(example);
        return categories;
    }

    public void create(Category category) {
        mapper.insert(category);
    }

    public void delete(Long id) {
        mapper.deleteByPrimaryKey(id);
    }

    public void update(Category category) {
        mapper.updateByPrimaryKeySelective(category);
    }
}
